{extend name='webautocode@public/content'}

{block name="button"}
{include file="public/header"}
<button data-modal='{:url("$classuri/tableadd")}' data-title="添加表" class='layui-btn layui-btn-sm'>添加表</button>
{/block}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">搜索标题</label>
        <div class="layui-input-inline">
            <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">表名</label>
        <div class="layui-input-inline">
            <input name="tablename" value="{$Think.get.tablename|default=''}" placeholder="请输入表名" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>

<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{empty name='list'}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td'>
                <input data-auto-none="" data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='text-left nowrap'>表注释</th>
            <th class='text-left nowrap'>表名</th>
            <th class='text-left nowrap'>创建情况</th>
            <th class='text-left nowrap'>状态</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>
        <tbody>
        <!--{foreach $list as $key=>$vo}-->
        <tr>
            <td class='list-table-check-td'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='text-left nowrap'>
                {$vo.title}
            </td>
            <td class='text-left nowrap'>
                {$vo.tablename}
            </td>
            <td class='text-left nowrap'>
                {php}
                $dbn_tabl = $vo['tablename'];
                $sql = "show tables like '".$dbn_tabl."';";
                {/php}
                {if empty(\Db::query($sql))}
                <span style="color: orange;">该表不存在</span>
                {else}
                <span style="color: green;">该表已创建</span>
                {/if}
            </td>
            <td class='text-left nowrap'>
                {if $vo.is_deleted eq 0}<span class="color-red">使用中</span>{elseif $vo.is_deleted eq 1}<span class="color-green">已禁用</span>{/if}
            </td>
            <td class='text-right nowrap'>

                <span class="text-explode">|</span>
                <a data-modal='{:url("$classuri/changetablecomment",["id"=>$vo.id])}'>改注释</a>


                <span class="text-explode">|</span>
                <a data-modal='{:url("$classuri/tocreatetable",["id"=>$vo.id])}'>创建</a>

                <span class="text-explode">|</span>
                <a data-modal='{:url("$classuri/tableedit")}?id={$vo.id}' data-title="编辑 当前系统版本: ">编辑</a>

                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='delete' data-action='{:url("$classuri/tabledel")}' data-confirm="数据删除后请手动删除表">删除</a>

            </td>
        </tr>
        <!--{/foreach}-->
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/empty}-->
</form>

{/block}